Repository navigation
[Port to black-forest] Fix invalid XML for emoji and math symbols in DocBook export - #22
Open
jabref-machine wants to merge 1 commit into
Open
jabref-machine wants to merge 1 commit into
jabref-machine wants to merge 1 commit into
Conversation
…17765) ### Summary When an entry contains emoji or some math symbols the DocBook exports created invalid XML, so XML parsers could not read the file. The reason is that `XMLChars` read the text one UTF-16 `char` at a time. These characters use two `char`s, so each half was written as a separate character reference. Now the formatter reads the text by Unicode code point, so each character becomes one valid reference. Other characters are escaped as before. ### Steps to test 1. Start JabRef and create a new library. 2. Add an entry of type "Article" with the title "Smile 😀 and alpha 𝛼 and é". 3. Select File -> Export -> Export all entries, choose DocBook 5.1 and save the file with the .xml extension. 4. Open the file in a web browser. The browser should show the XML tree with the title "Smile 😀 and alpha 𝛼 and é". How it is know: <img width="513" height="314" alt="image" src="https://github.com/user-attachments/assets/bf6fecc2-276a-4b5c-bec9-6cfd9328293c" /> How it was before: <img width="1131" height="233" alt="image" src="https://github.com/user-attachments/assets/b3debf82-5936-4b27-bda8-107457fe960b" /> ### Related issues and pull requests Closes JabRef#17747 ### AI usage I used Claude Code (model claude-opus-5-5) as an assistant. It helped me understand why surrogate pairs created invalid XML and suggested the code change. I reviewed and adjusted the code, wrote the steps to test, and ran the tests and the manual export myself. ### Checklist - [x] I own the copyright of the code submitted and I license it under the [MIT license](https://github.com/JabRef/jabref/blob/main/LICENSE) - [x] If AI tools were used, I disclosed them in the "AI usage" section and reviewed, understood, and take full ownership of all AI-generated code - [x] I manually tested my changes in running JabRef (always required) - [x] I added JUnit tests for changes (if applicable) - [x] I added screenshots in the PR description (if change is visible to the user) - [x] I added **one sentence (max 20 words)** to `CHANGELOG.md` describing the change from the user's point of view (if the change is visible to the user) - [/] I checked the [user documentation](https://docs.jabref.org/) for up to dateness and submitted a pull request to our [user documentation repository](https://github.com/JabRef/user-documentation/tree/main/en) --------- Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com> (cherry picked from commit 61dcea6)
6 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of JabRef#17765 to
black-forest, see Branching strategy.If this PR is a draft, the cherry-pick conflicted: the conflicting files are committed with Git's conflict markers left in. Resolve the markers locally, push, and mark the PR ready.